package com.example.springbootfastjson2.utils;

import com.alibaba.fastjson.JSONObject;

/**
 * @program: springboot-fastjson2
 * @description: 测试
 * @author: XianJin.Lu
 * @create: 2021-09-08 21:05
 **/
public class Test {

    public static void main(String[] args) {
        JsonUtils jsonUtils = new JsonUtils();
        String s1= "{hello:\"world\",head : { \"cmdType\":2, \"cmdSn\":2222 } ,data : { \"devId\":2,\"operType\":0,\"doorIndex\":1 } }";


        JSONObject jsonObject = jsonUtils.getJSONObject(s1);
        System.out.println(jsonObject);


        JSONObject data = jsonUtils.getSonJSONObject(s1, "data");
        System.out.println(data);


        System.out.println(data.get("operType"));
    }
}
